﻿using UnityEngine;
using System.Collections;

public class ballTurn : MonoBehaviour {

	public int velocity = 1;// 旋转速度
    public bool switchBool = true;
	public int rotateStatus = 1;//1:顺时针,2:逆时针
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (switchBool) {
			if(rotateStatus == 1){
				transform.Rotate(0, 0, -(velocity * Time.deltaTime));// 顺时针旋转，角度计算为负值
            }
            else{
				transform.Rotate(0, 0, (velocity * Time.deltaTime));// 逆时针旋转，角度计算为正值
            }
		} 
	}
    // 开始旋转，启用旋转功能
    public void onPlay(){
		switchBool = true;
	}
    // 停止旋转，禁用旋转功能
    public void onStop(){
		switchBool = false;
	}
}
